<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>补充-函数对象原型关系回顾</title>
</head>
<body>

  <script>
    console.log(new Function());
    function fun() {
      console.log(this, this.name, this.age);
    }
    console.log(fun.__proto__ === Function.prototype, fun.prototype === Function.prototype);
    // 1.对象中的某些属性和方法是来自Function.prototype
    function test() {}
    // fun.__proto__ === Function.prototype
    // fun当做一个对象, 获取apply方法
    fun.apply({name: 'lisi', age: 18}, [1, 2, 3]);
    console.log(fun.prototype.call);
    console.log(Function.prototype.call);
    console.log(Function.prototype.apply);
    console.log(Function.prototype.apply === fun.apply);
    console.log(Function.prototype.__proto__ === Object.prototype);
    console.log(Function.prototype.__proto__);
    
    // 2.在Function.prototype中添加的属性和方法, 可以被所有的函数获取
    Function.prototype.message = "hello world"
    console.log(test.message)
    console.log(fun.message)
    Function.prototype.bar = function() {
      console.log("bar function execution")
    }
    test.bar()
    fun.bar()
    
    
    
    
  </script>
  
</body>
</html>